package com.xiaoshuidi.cloud.module.rooms.mapper;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.xiaoshuidi.cloud.module.rooms.controller.admin.iot.vo.RoomDiviceAssociationVo;
import com.xiaoshuidi.cloud.module.rooms.controller.admin.nonIntelligentDevice.vo.RoomNameVO;
import com.xiaoshuidi.cloud.module.rooms.pojo.RoomDevicePriceAssociation;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * 水电煤阶梯价格关联表 Mapper 接口
 * </p>
 *
 * @author James
 * @since 2023-06-07
 */
public interface RoomDevicePriceAssociationMapper extends BaseMapper<RoomDevicePriceAssociation> {
    @Select("select rsdpa.*,rh.apartment_id apartmentId from room_sdiot_device_price_association rsdpa " +
            " left join room_house rh on rsdpa.room_id=rh.id " +
            "where ${ew.sqlSegment}")
    List<RoomDiviceAssociationVo> getRoomDeviceAssociationList(@Param("ew") QueryWrapper<?> wrapper);

    @Select("select rsdpa.* from room_sdiot_device_price_association rsdpa " +
            " left join room_sdiot_device_price rsdp on rsdpa.device_price_id = rsdp.id " +
            "where ${ew.sqlSegment}")
    List<RoomDevicePriceAssociation> getNotInRoom(@Param("ew") QueryWrapper<?> wrapper);
    @Select("select room_id from room_sdiot_device_price_association ")
    List<Long> getNotRoomIdPay();
    List<RoomNameVO>  findRoomName(@Param("roomId")Long roomId);

    void deleteRoomDevice(@Param("id")Long id, @Param("apartmentId")Long apartmentId);
}
